05_PRACTICAL_REVERSE_ENG PORTAL
Week 2 Arrays · Dual Sovereign Core (AR / EN)
⚑ PROBLEM SET DECONSTRUCTION & ALGORITHMS
AYMAN ELMASRY
Computational Creative Director · AI Prompt Engineer
Founder of Ayman Elmasry LLC
πŸ”’ ⚑ AEL Sovereign Seal (Active Master Verification)
{
  "ael_seal": "AEL CS Encyclopedia β€” Β© Ayman Elmasry",
  "owner": "Ayman Elmasry",
  "legal_entities": [
    "Ayman Elmasry LLC (UAE)",
    "Ayman Elmasry Advertising & Marketing (Egypt)"
  ],
  "syllabus_source": "Harvard CS50x 2026-2027",
  "domain": "Week 2: Scrabble, Readability & Ciphers",
  "document_type": "05_Practical_Reverse_Eng",
  "methodology": "8-Stage Sub-Silicon Execution Paradigm",
  "system_version": "v3.0"
}

Week 2 Practical Reverse Engineering: Scrabble & Ciphers

Section 1: Scrabble Engine Deconstruction

The execution binary prompts two interactive users for distinct vocabulary string inputs. It dynamically calculates the absolute cumulative score of each word utilizing an immutable point matrix, subsequently printing the definitive winner to standard output.

===================================================================================
             SCRABBLE REVERSE ENGINEERING PIPELINE
===================================================================================

  [ Input String (Word) ] ──> [ Loop Character by Character (strlen) ]
                                      β”‚
                                      β–Ό
             [ isalpha() ? Convert to Uppercase (toupper) ]
                                      β”‚
                                      β–Ό
             [ Index Calculation: char - 'A' (0 to 25) ]
                                      β”‚
                                      β–Ό
             [ Lookup in POINTS[] Matrix ] ──> [ Accumulate Total Score ]

===================================================================================
  • The POINTS Lookup Matrix: Character weightings are statically allocated within a 26-element integer matrix int POINTS[] = {1, 3, 3, 2, ...}.
  • Forensic Indexing Mechanism: To extract the integer weight of character C, the CPU executes the baseline subtraction 67 - 65 ('A') = 2.

Section 2: Readability Engine Deconstruction

Rather than instantiating three isolated loops to evaluate letter, word, and sentence totals, we construct an optimized, unified single-pass scanner that inspects the character stream in real-time.

===================================================================================
             READABILITY PARSER LOGIC TREE
===================================================================================

                [ Character Scanner (s[i]) ]
                 β”œβ”€β”€ isalpha(s[i]) ──> letters++
                 β”œβ”€β”€ isspace(s[i]) ──> words++ (Initialize words at 1)
                 └── s[i] == '.' || s[i] == '!' || s[i] == '?' ──> sentences++

===================================================================================
  • Strict Coleman-Liau Mathematical Application: Computing exact letter/sentence ratios and rounding the final float to output Grade X.

Section 3: Cryptographic Cipher Engines (Caesar & Substitution)

Forensic deconstruction of the Caesar and Substitution problem sets to validate CLI parameters and enforce strict cryptographic transformations.

  • CLI Argument Guardrails: The main entry point must enforce argc == 2 and validate the key format (numeric for Caesar, 26 unique alpha characters for Substitution).
  • Case Preservation Protocol: During mathematical rotation, uppercase and lowercase characters maintain their exact casing, while non-alphabetical punctuation bypasses transformation entirely.